﻿var Page = function(pageContainer) {
    var self = this;
    this.IsInitialized = false;
    this.Title = "";
    this.CanGoBack = true;

    this.LastScrollY = 0;

    this.Actions = [];

    this.changePage = function() {
        if (!self.canNavigate())
            return false;

        if (app.CurrentPage) {
            app.CurrentPage.instance.LastScrollY = $(document).scrollTop();

            if (app.LeftMenu.instance && app.LeftMenu.instance.isVisible())
                app.LeftMenu.instance.hide();

            app.CurrentPage.container.trigger('onBeforePageHide').hide().trigger('onPageHide');
        }

        pageContainer.trigger('onBeforePageShow').show().trigger('onPageShow');
        setTimeout(function() {
            $(document).scrollTop(self.LastScrollY);
        }, 10);

        return true;
    };

    this.closePopups = function() {};

    this.canNavigate = function() { return true; };

    this.initialize = function() {
        self.IsInitialized = true;
    };
};